FROM registry.cn-hangzhou.aliyuncs.com/sjdskl/php5.3-fpm

RUN set -eux; \
    sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories;\
    apk add --no-cache --virtual .build-deps autoconf make g++ libtool pcre-dev  dpkg-dev dpkg pkgconf zlib zlib-dev tzdata;\
    apk add --no-cache --repository http://mirrors.aliyun.com/alpine/edge/community gnu-libiconv;\
	cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime;\
	pecl install memcache-2.2.7 && docker-php-ext-enable memcache;\
	pecl install redis-2.2.8 && docker-php-ext-enable redis; \
    php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"; \
	php composer-setup.php; \
	php -r "unlink('composer-setup.php');"; \
	mv composer.phar /usr/local/bin/composer; \
	chmod 755 /usr/local/bin/composer; \
	composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/; \
    apk del .build-deps; \
	rm -rf /var/cache/apk/* /tmp/* /var/tmp/* /usr/share/doc/*


RUN sed -i "s/listen = 127.0.0.1:9000/listen = 9000/g" /usr/local/etc/php-fpm.d/www.conf


ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php

WORKDIR    /var/www/

EXPOSE 9000
